<div class="row m-n">
    <div tabset type="tab">
        <div tab heading="网点管理" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="addData()" ng-disabled="!btnPermission.storefrontAdd" title="{{!btnPermission.storefrontAdd?'无权限执行此操作':''}}">新增</button>
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <button type="button" class="btn btn-default base-color" title="配置表格列"
                                ng-click="switchToolbar('ColConfig');">
                            <i class="yb-icon ico-set"></i>
                        </button>
                    </div>
                    <button class="btn-advance pull-right m-l-xs" ng-click="switchToolbar('AdvanceSearch')">高级搜索</button>
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" placeholder="网点名称"
                               ng-model="condition.storeName">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)">搜索</span>
                    </div>
                </div>
            </div>
            <div yb-advance-search show-toolbar="toolbarConfig.showAdvanceSearch" search-data="search(1)" reset-data="reset()">
                <div class="advance-search m-t-sm">
                    <div class="form-group clearfix">
                        <label class="control-label">网点名称：</label>
                        <input type="text" name="dealerCode" ng-model="condition.storeName" class="form-control">
                    </div>
                </div>
            </div>
            <div yb-col-config show-toolbar="toolbarConfig.showColConfig" ng-model="tbConf" col-fixed="true"
                 has-check-col="true" set-tb-style="setFixedWidth()"></div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none" width="{{tbConf.fixedWidth}}">
                            <thead>
                            <tr>
                                <th ng-repeat="itemCol in tbConf.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-click="toSort(tbConf.tableCol, $index)" ng-show="!!itemCol.isShow && !!itemCol.isFixed" class="border-r-none">
                                    <div yb-thead-operate ng-model="itemCol" target-width="tbConf.fixedWidth" fixed-width="tbStyle.scrollLeft"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{tbConf.scrollWidth}}">
                            <thead>
                            <tr>
                                <th ng-repeat="itemCol in tbConf.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-click="toSort(tbConf.tableCol, $index)" ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                    <div yb-thead-operate ng-model="itemCol" target-width="tbConf.scrollWidth"></div>
                                </th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y">
                        <table class="table-fixed border-none" width="{{tbConf.fixedWidth}}">
                            <tbody>
                            <tr ng-repeat="item in dataList track by $index" ng-class="{'row-selected': $index === markInfo.cueRow}"
                                ng-click="selectRow($index)">
                                <td class="spill-dots border-r-none border-l-none" ng-repeat="itemCol in tbConf.tableCol track by $index" width="{{itemCol.width}}"
                                    ng-show="!!itemCol.isShow && !!itemCol.isFixed" title="{{item[itemCol.dataField]}}">
                                    <span ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                    <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)" ng-if="!!itemCol.clickFn">
                                        {{item[itemCol.dataField]}}
                                    </a>
                                    <div class="font-0" ng-if="itemCol.type === 'operate'">
                                        <button class="btn btn-operate m-r-xs" ng-click="editData(item)"
                                                ng-disabled="!btnPermission.storefrontEdit" title="{{!btnPermission.storefrontEdit?'无权限执行此操作':''}}">编辑</button>
                                        <button class="btn btn-operate m-r-xs" ng-click="delData(item.storeId)"
                                                ng-disabled="!btnPermission.storefrontDel" title="{{!btnPermission.storefrontDel?'无权限执行此操作':''}}">删除</button>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-style="tbStyle.scrollLeft">
                        <table class="table-fixed border-none" width="{{tbConf.scrollWidth}}">
                            <tbody>
                            <tr ng-repeat="item in dataList track by $index" ng-class="{'row-selected': $index === markInfo.cueRow}" ng-click="selectRow($index)">
                                <td class="spill-dots" ng-repeat="itemCol in tbConf.tableCol track by $index"
                                    width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                    title="{{item[itemCol.dataField]}}">
                                    <span ng-if="!itemCol.clickFn && itemCol.type !== 'operate'">{{item[itemCol.dataField]}}</span>
                                    <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)" ng-if="!!itemCol.clickFn">
                                        {{item[itemCol.dataField]}}
                                    </a>
                                    <div class="font-0" ng-if="itemCol.type === 'operate'">
                                        <button class="btn btn-operate m-r-xs" ng-click="editData(item)"
                                                ng-disabled="!btnPermission.storefrontEdit" title="{{!btnPermission.storefrontEdit?'无权限执行此操作':''}}">编辑</button>
                                        <button class="btn btn-operate m-r-xs" ng-click="delData('single', item.id)"
                                                ng-disabled="!btnPermission.storefrontDel" title="{{!btnPermission.storefrontDel?'无权限执行此操作':''}}">删除</button>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>
        <div tab heading="{{tabFlag.name}}" active="activeFlag[1]" ng-if="activeFlag[1]">
            <form name="form" class="form-horizontal wrapper-md clearfix" novalidate>
                <div class="form-group">
                    <label class="col-xs-2 control-label"><i>*</i>客户：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" name="dealerName" class="form-control light-bg" ng-model="detailInfo.dealerName"
                            ng-click="selectDealer()" required yb-focus readonly placeholder="请选择" ng-disabled="tabFlag.type === 1">
                    </div>

                    <div class="col-xs-4 msg-block"
                         ng-show="form.dealerName.$dirty || (form.dealerName.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.dealerName.$error.required && !form.dealerName.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-2 control-label"><i>*</i>网点名称：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" name="storeName" class="form-control" required yb-focus ng-model="detailInfo.storeName" maxlength="20">
                    </div>
                    <div class="col-xs-4 msg-block"
                         ng-show="form.storeName.$dirty || (form.storeName.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.storeName.$error.required && !form.storeName.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>
                <div class="form-group" ng-if="isJCH">
                    <label class="col-xs-2 control-label"><i>*</i>CRM网点类型：</label>
                    <div class="col-xs-5 wrapper-none">
                        <select name="dealerType" class="form-control" ng-model="detailInfo.dealerType" required ng-change="handleDealerTypeChange()">
                            <option value="">请选择</option>
                            <option value='0'>代理商</option>
                            <option value='1'>服务站</option>
                        </select>
                    </div>
                    <div class="col-xs-4 msg-block"
                        ng-show="form.dealerType.$dirty || (form.dealerType.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.dealerType.$error.required && !form.dealerType.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>
                <div class="form-group" ng-if="isJCH">
                    <label class="col-xs-2 control-label">仓库：</label>
                    <div bj-multi-selector class="col-xs-5 wrapper-none dropdown-prop" bj-click="handleWarehouseClick()" name="warehouse"
                        ng-model="selectedData.warehouse" value-list="warehousesSource" placeholder="请选择仓库" ids-key="warehouseCode" label-key="warehouseCode"></div>
                    <div class="col-xs-4 msg-block"
                         ng-show="form.warehouse.$dirty || (form.warehouse.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.warehouse.$error.required">
                            <i class="yb-icon ico-times-circular"></i>必填项，请选择
                        </div>
                    </div>
                </div>
                <div class="form-group" ng-if="isJCH">
                    <label class="col-xs-2 control-label"><i ng-if="detailInfo.dealerType==0">*</i>CRM网点名称：</label>
                    <div class="col-xs-5 wrapper-none">
                        <div bj-select name="crmAgent" ng-required="detailInfo.dealerType==0" source="crmAgentNameList" source-label-key="crmAgentName"
                            ng-model="selectedData.crmAgent" bind-key="crmAgentCode"></div>
                    </div>
                    <div class="col-xs-4 msg-block"
                         ng-show="form.crmAgent.$dirty || (form.crmAgent.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.crmAgent.$error.required && !form.crmAgent.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>
                <div class="form-group" ng-if="isJCH">
                    <label class="col-xs-2 control-label"><i>*</i>CRM服务站：</label>
                    <div class="col-xs-5 wrapper-none">
                        <select class="form-control" ng-model="selectedData.serviceStation" name="serviceStation" required
                            ng-options="item as item.serviceStationName for item in serviceStatioNameList">
                            <option value="">请选择</option>
                        </select>
                    </div>
                    <div class="col-xs-4 msg-block"
                         ng-show="form.serviceStation.$dirty || (form.serviceStation.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.serviceStation.$error.required && !form.serviceStation.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-2 control-label"><i ng-if="!isJCH">*</i>所在地区：</label>
                    <select name="provinceId" ng-model="detailInfo.provinceId" class="form-control m-r-sm area col-xs-3"
                            ng-options="item.provinceId as item.province for item in provinceList" ng-change="getCity('city', detailInfo.provinceId,true)">
                        <option value="">请选择省份</option>
                    </select>
                    <select name="cityId" ng-model="detailInfo.cityId" class="form-control m-r-sm area col-xs-3"
                            ng-options="item.cityId as item.city for item in cityList" ng-change="getCity('area', detailInfo.cityId,true)">
                        <option value="">请选择城市</option>
                    </select>
                    <select name="areaId" ng-model="detailInfo.areaId" class="form-control area col-xs-3" ng-required="!isJCH" yb-focus
                            ng-options="item.areaId as item.area for item in areaList" ng-change="getCity('', detailInfo.areaId)">
                        <option value="">请选择区/县</option>
                    </select>

                    <div class="col-xs-4 msg-block"
                         ng-show="form.areaId.$dirty || (form.areaId.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.areaId.$error.required && !form.areaId.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-2 control-label"><i ng-if="!isJCH">*</i>详细地址：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" ng-required="!isJCH" yb-focus name="addreass" class="form-control" ng-model="detailInfo.addreass" maxlength="200">
                    </div>

                    <div class="col-xs-4 msg-block"
                         ng-show="form.addreass.$dirty || (form.addreass.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.addreass.$error.required && !form.addreass.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-2 control-label"><i ng-if="!isJCH">*</i>联系人：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" name="contactName" ng-required="!isJCH" yb-focus class="form-control" ng-model="detailInfo.contactName" maxlength="20">
                    </div>
                    <div class="col-xs-4 msg-block"
                         ng-show="form.contactName.$dirty || (form.contactName.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.contactName.$error.required && !form.contactName.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-2 control-label"><i ng-if="!isJCH">*</i>联系方式：</label>
                    <div class="col-xs-5 wrapper-none">
                        <input type="text" name="contactTel" class="form-control" ng-model="detailInfo.contactTel"
                               yb-focus ng-required="!isJCH" maxlength="20">
                    </div>

                    <div class="col-xs-4 msg-block"
                         ng-show="form.contactTel.$dirty || (form.contactTel.$invalid && submitted)">
                        <div class="error-msg" ng-if="form.contactTel.$error.required && !form.contactTel.focused">
                            <i class="yb-icon ico-times-circular"></i>必填项，请填写
                        </div>
                    </div>
                </div>

                <div class="form-group m-b-sm">
                    <label class="col-xs-2 control-label">是否启用：</label>
                    <label class="col-xs-5 control-label p-l-n text-left clearfix">
                        <input type="radio" class="m-r-sm pull-left" yb-radio
                               ng-model="detailInfo.isEnable" value="1"
                               yb-radio-name="是">
                        <input type="radio" class="m-r-sm pull-left" yb-radio
                               ng-model="detailInfo.isEnable" value="0"
                               yb-radio-name="否">
                    </label>
                </div>

                <div class="form-group">
                    <div class="col-xs-offset-2">
                        <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData(form.$valid)">保存
                        </button>
                        <button type="button" class="btn btn-default" ng-click="changeTab(0)">取消</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>